﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101300677420";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCDGFmNUsPm0pUb8hQOQi71MoAe1sgYEorYFF3P/mLD4QCAbZj5quvdfilTG2AD9WiwMhsL3aMaNSlvuHpXwbMSx+zg6C9fETqf+WK/1w8+5OWHLjgTV/UukWwrpB7GvRt23og6kRvo9WgX4p960khIkha/GjICNk+At9kaWOpZ1Q+VSkxra7iE22nBSCHzALFVnw/hc+qOH+L395WbbyRYtIrtLUNBYmdRoPTKDzc9l8IaO+Y+0TVN6UbQDvYP6JJgN1KxDtoYYCBj0fD0x3zcyB3ioUUqDtxageX7xXf2RyrX1rtQCdORDaS5VHo2SRGPCzKjNbEgnC3css7bMguPAgMBAAECggEAIGlFwr4Cty+7M9SPBtNwHqkkqfs6L1FuSGwIoaLoMjuPzzDJkHikpfdKKkTrYS8sedt5el6Ks7EPFJMMlGPMbUlGlHhzNdLhpqmWs41tNISNBvXzYTzu3luP3d5OyZ35i1MLZUd5GgiKetVJzqjsvBx6STclxAw/bbiGkZAIKLs86t+RbjU+S0wXpSKD3V6nhD5gry4fQTIw01/kD4ZehENW5NpwAiVJH8NJRzKMXERo62gr8c3AWlCqKiUbfWWb3/Cs+4c34RObofU/KS5s+kUHGIAo6nXyL0Mpyg9VaJasT4F2XrZXlLICx6CubHPFwlt7oCPgM/NOXGt6krJaGQKBgQC7J5eMcWFcYwVyGPfqTYBW7swtY08oVV/dCWvFoDuKoijqauGoV4jp7ppoUCXkRzk8oYIKw/I6aFcwlBRNLDPh9G/SOOV+tuqvJiLC7Vak9tXOYE06egd9VHOWYg4ncUdgTbKXNotbMb/VGP8e+77lBUEkhkyj4q1MVLwCVPw+5QKBgQCzUZ1iVhwMJXauaD5hM3vSCZOXyKAthvNnJz1IJWEqaT2TI7bKmmOW3uc/yxunEPam+DH91ByUe6qBX7641svIpho+yZbXYvvOZuQzgTbjW5L0XnWT3YCHFoeCJ8ym/d1JXBbO48/NNxm+eUUI3REJGQo3o9y09PJuUz5W4MpFYwKBgQCAuhG16sJRvlYfjWbwBJCSurs7OMRYdKh0KyeyjayGhVTpL8y4ckTcyl3wA7icVBTdTCVa7D2uyNe3tRJlplKlRvCmwrWvO3ceM3fTZVWkL5cN1RUpdIe0P6MlO5qKrJKwfaCp+z1M42IT25aWpAdAFSYiTjFmw+H4z4tlezjotQKBgQCJ9kL2Q3X0ymYTLVTBCBE9uex6HPtPy8I9HO2DMm8daDbdm96o5ju0+e5FIIk38k8yi0Y7GhSbEMJQI0/jei7zQwhyQjrxn9BILtVn4wRNzEi2Bm7Dwul+BZFgTCqiWDMGm/lYV+Gq67e82iSI+zx+GWvI/yNxfft/ckBGK1C0LQKBgQCrTexDfecwtO84EtuA8mR9PtguUYb1Kx+XtnF7GoyH5LjhFodlxjGgxj68cr50okmZ3oViDoNXzBBh1717VY4fuEcBEwmVVIub93r6O8IoaIdXDkv/oQ1NY+lHiX1qydwR0WrNDVKeZSbWVHaSGmaH2cwZP2QknciU4mmxlV5sbw==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg1uXIeObCkiCYgTcth0BJfoVmV528jIbk5YuAJFYscD25J915th5/qki5pG1qhWg174RiaX7HYdc1RXuCd9fmiLTBzoC+nEM82fWH16ebL7CCUIypihm1xOLGCOcjlElbyXxnaEw5ZtXogRGw9qrf8nZvvgg7QSAamtAtEdR+Tze3/ax6qapncuWzqbWmydCkbWvzqfUnJlRbwcwYzUNws8xpIOJ+3s+lE2F/G4VU8zJAABY4egkXSXPxBp2JPdB213wtGyWYmjsodSGxBcyurHpRxHtshVgdrmhyaKRnv1f6Io1IcelLPXb6qol5eLRe0o1XFBHn3d04aOUXFhfPwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/PSCVN/BVip";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

